import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
// import { HttpExceptionFilter } from './common/filters/http-exception.filter'; // 导入自定义的过滤器
import { HttpExceptionFilter1 } from './common/filters/all-exception.filter'; // 导入自定义的过滤器
import { TransformInterceptor } from './common/interceptor/transform.interceptor';
import { NestExpressApplication } from '@nestjs/platform-express';

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);
  // app.useGlobalFilters(new HttpExceptionFilter());
  // 注册全局响应拦截器
  app.useGlobalInterceptors(new TransformInterceptor());
  // 注册全局异常过滤器
  app.useGlobalFilters(new HttpExceptionFilter1());
  //配置静态资源目录
  // app.useStaticAssets('public');
  app.useStaticAssets('public', { prefix: '/public/' });
  app.useStaticAssets('view');
  await app.listen(3000);
}
bootstrap();
